package com.tj.mapper;

import com.tj.pojo.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UsersMapper {
    @Select("select * from users")
    List<Users> findAllList();
    @Select("select * from users where realName like '%${value}%'")
    List<Users> findUserListByName(String realName);
    @Select("select * from users where userId=#{userId}")
    List<Users> findUsersListById(String userId);
    @Insert("insert into users(userId, password, realName, sex, identityCard, birthday, userType) values (#{userId}, #{password}, #{realName}, #{sex}, #{identityCard}, #{birthday}, #{userType})")
    int insertUsers(Users users);
    @Update("update users set password = #{password}, realName = #{realName}, sex = #{sex}, identityCard = #{identityCard}, birthday = #{birthday}, userType = #{userType} where userId = #{userId}")
    int updateUsers(Users users);
    @Delete("delete from users where userId = #{userId}")
    int deleteUsers(Users users);
    @Select("select * from users where userId = #{userId} and password = #{password}")
    Users login(Users users);

}
